local skel = fk.CreateSkill {
  name = "lb__shengjie",
  tags = { Skill.Wake }
}

Fk:loadTranslationTable {
  ["lb__shengjie"] = "生界",
  --[":lb__shengjie"] = "<b>觉醒技</b>，当<a href=':lb__huaqi'><font color='red'>〖花祈〗</font></a>触发所有项后，你修改技能<a href=':lb__huaqi'><font color='red'>〖花祈〗</font></a>为：你与成为过〖花祈〗目标的角色于每轮首次造成伤害后可以摸X张牌（X为成为过〖花祈〗目标的存活角色数）。",
  --9.18
  --[":lb__shengjie"] = "<b>觉醒技</b>，当<a href=':lb__huaqi'><font color='red'>〖花祈〗</font></a>触发所有项后，你修改技能<a href=':lb__huaqi'><font color='red'>〖花祈〗</font></a>为：你与成为过〖花祈〗目标的角色于每轮首次受到伤害后可以摸X张牌（X为成为过〖花祈〗目标的存活角色数）。",
  --10.6
  [":lb__shengjie"] = "<b>觉醒技</b>，当<a href=':lb__huaqi'><font color='red'>〖花祈〗</font></a>触发所有项后，你修改技能<a href=':lb__huaqi'><font color='red'>〖花祈〗</font></a>为：每轮限X次，你或成为过〖花祈〗目标的角色受到伤害后，你可以令其摸X张牌（X为成为过〖花祈〗目标的角色数）。",


  ["$lb__shengjie1"] = "凡夺取的，必将偿还。",
  ["$lb__shengjie2"] = "清算的时刻到了。",
}

skel:addEffect(fk.AfterSkillEffect, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and player:usedSkillTimes(skel.name, Player.HistoryGame) == 0
  end,
  can_wake = function(self, event, target, player, data)
    local huaqi = Fk.skill_skels["lb__huaqi"]
    if huaqi and player:getMark("lb__shengjie") == 0 and player:hasSkill("lb__huaqi", true) then
      local num = 0
      for _, choice in ipairs({"lose", "dying", "kongcheng"}) do
        if huaqi:withinBranchTimesLimit(player, choice, Player.HistoryGame) then
          num = num + 1
        end
      end
      return num == 0
    end
  end,
  on_use = function (self, event, target, player, data)
    player.room:setPlayerMark(player, "@[skill_choices]lb__huaqi", 0)
    player.room:setPlayerMark(player, skel.name, 1)
  end,
})

return skel
